package design.simdi.code.final_paper.utils;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.wizard.IWizard;
import org.apache.wicket.markup.html.form.Form;

/**
 * 
 * @author Marius Dumitriu - (Jun 21, 2010 - 10:15:06 PM)
 * 
 */
public class AjaxCancelButton extends WizardAjaxButton {

	private static final long serialVersionUID = 1L;

	public AjaxCancelButton(String id, IWizard wizard, Form<?> form) {
		super(id, wizard, form, "org.apache.wicket.extensions.wizard.cancel");
		setDefaultFormProcessing(false);
	}

	@SuppressWarnings("unchecked")
	@Override
	protected void onClick(AjaxRequestTarget target, Form form) {
		getWizardModel().cancel();
		onCancel(target);
	}

	public void onCancel(AjaxRequestTarget target) {

	}

	public final boolean isEnabled() {
		return true;
	}

	@Override
	public final boolean isVisible() {
		return getWizardModel().isCancelVisible();
	}

}
